package com.atguigu.srb.core.controller.admin;


import com.atguigu.srb.base.result.ResponseVo;
import com.atguigu.srb.core.pojo.entity.LendReturn;
import com.atguigu.srb.core.service.LendReturnService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 还款记录表 前端控制器
 * </p>
 *
 * @author Atguigu
 * @since 2024-10-11
 */
@RestController
@RequestMapping("/admin/core/lendReturn")
public class AdminLendReturnController {

    @Resource
    LendReturnService lendReturnService;

    @ApiOperation("查询标的的还款计划")
    @GetMapping("listLendReturns/{lenId}")
    public ResponseVo listLendReturns(@PathVariable("lenId")Long lenId){
        List<LendReturn> lendReturns = lendReturnService.list(Wrappers.lambdaQuery(LendReturn.class)
                .eq(LendReturn::getLendId, lenId)
                .orderByAsc(LendReturn::getCurrentPeriod));
        return ResponseVo.ok().data("items",lendReturns);
    }

}

